
//
//  UIBarButtonItem+Extension.swift
//  HDSwfitWeibo
//
//  Created by wty on 16/4/12.
//  Copyright © 2016年 wty. All rights reserved.
//

import UIKit
extension UIBarButtonItem {

    class func  createBarButtonItem(imageName:String , highlightedIamgeName:String , target : AnyObject?, action:Selector)->UIBarButtonItem
    {
        let btn  = UIButton()
        btn.setBackgroundImage(UIImage(named: imageName), forState: UIControlState.Normal)
        btn.setBackgroundImage(UIImage(named:  highlightedIamgeName), forState: UIControlState.Highlighted)
        btn.sizeToFit()
        btn.addTarget(target, action: action, forControlEvents: UIControlEvents.TouchUpInside)
        return UIBarButtonItem(customView: btn)
    }
    
    
}
